export default {
    addCart(context,payload){
        return new Promise((resolve)=>{
            let oldProduct=context.state.cartList.find(item=>item.iid===payload.iid);
        if(oldProduct){
            context.commit("addCounter",oldProduct)
           resolve("当前商品+1")
        }else{
            payload.count=1;
            context.commit("addToCart",payload)
            resolve("商品已经添加到购物车")
        }
        })
    }
}